#ifndef LEVEL_H
#define LEVEL_H
#include "Tile.h"
#include "Image.h"
#include <string>
//#include <QuadTree.h>
#include <TileSheet.h>
/// @todo Add PutTile, EraseTile, and other map functions

class Level
{
public:
    Level();
    ~Level();

    void Allocate(int l, int w, int h);
    void DeAllocate();

    void SetImageDir(std::string dir);

    void PlaceTile(int mouseX, int mouseY, int layer, TileSheet&);

    void SetUpTiles();

    void Render(int left =0, int top = 0);

    bool IsAllocated();

    bool IsShowen(int layer);

    void ShowLayer(int layer, bool show = true);

    void Load(std::string file, TileSheet &sheet);
    void Save(TileSheet& sheet);
    void New(int width, int height, std::string mapName);

    /// NEW (DS functions)
    void LoadDS(std::string file, TileSheet& sheet);
    void SaveDS(std::string name);
    void NewDS(int width, int height);
    /// NEW

    void SetCurrentLayer(int layer){ m_currentLayer = layer; }

    //Tile*** GetTileList() { return m_tile; }

    int  GetWidth() { return m_width; }
    int  GetHeight(){ return m_height; }

    void SetSize(int size){ mySize= size; }
    int GetSize() { return mySize; }

private:
    int mySize;
    Tile m_tile[4][500][500];
    int m_currentLayer;
    int m_width, m_height, m_layers;
    bool m_showLayer[4];
    std::string m_imageDir, m_mapName;
    bool m_allocated;
};

#endif // LEVEL_H
